package com.example.yyjc.service.impl;

import com.example.yyjc.domain.industryanalyze.*;
import com.example.yyjc.mapper.IndustryAnalyzeMapper;
import com.example.yyjc.service.IndustryAnalyzeService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName IndustryAnalyzeServiceImpl
 * @Description TODO
 * @Author lvyongwei
 * @Date 2020-11-20 10:06
 **/
@Service
public class IndustryAnalyzeServiceImpl implements IndustryAnalyzeService {

    @Autowired
    private IndustryAnalyzeMapper industryAnalyzeMapper;

    /**
     * 获取所有一级类目以及几个月的总销量
     * @return
     */
    @Override
    public List<FirstCat> getFirstCatTitle() {
        return industryAnalyzeMapper.getFirstCatTitle();
    }

    /**
     * 根据一级类目id获取到所有二级类目及几个月的总销量
     * @param firstCatTitleId
     * @return
     */
    @Override
    public List<SecondCatSale> getSecondCatTitle(Integer firstCatTitleId) {
        return industryAnalyzeMapper.getSecondCatTitle(firstCatTitleId);
    }

    /**
     * 根据二级目录id获取其占一级目录比例
     * @param secondCatTitleId
     * @return
     */
    @Override
    public List<SecondCatSale> getScale(Integer secondCatTitleId) {
        return industryAnalyzeMapper.getScale(secondCatTitleId);
    }

    /**
     * 获取二级标题销售量
     * @param secondCatTitleId
     * @return
     */
    @Override
    public List<SecondCatSale> getSecondCatSalesVolume(Integer secondCatTitleId,List<String> times) {
        return industryAnalyzeMapper.getSecondCatSalesVolume(secondCatTitleId,times);
    }


    /**
     * 获取二级类目国家销量
     * @param secondCatTitleId 二级类目id
     * @param time
     * @return
     */
    @Override
    public List<SecondCatSale> getCountryRanking(Integer secondCatTitleId, String time) {
        return industryAnalyzeMapper.getCountryRanking(secondCatTitleId, time);
    }

    /**
     * 获取二级类目国家总销量和
     * @param secondCatTitleId 二级类目id
     * @param time
     * @return
     */
    @Override
    public Double getCountrySum(Integer secondCatTitleId, String time) {
        return industryAnalyzeMapper.getCountrySum(secondCatTitleId, time);
    }

    /**
     * 获取发货前三的国家
     * @return
     */
    @Override
    public List<String> getDeliveryCountry(Integer secondCatTitleId) {
        return industryAnalyzeMapper.getDeliveryCountry(secondCatTitleId);
    }

    /**
     * 获取前三国家各个月份发货订单数量
     * @param countryName
     * @param times
     * @param secondCatId
     * @return
     */
    @Override
    public List<String> getDeliveryCountryCount(String countryName, List<String> times, Integer secondCatId) {
        return industryAnalyzeMapper.getDeliveryCountryCount(countryName,times,secondCatId);
    }

    /**
     * 获取行业某个月份卖家发货信息
     * @param secondCatTitleId
     * @param time
     * @return
     */
    @Override
    public List<DeliveryCountry> getAllDeliveryCountryCount(Integer secondCatTitleId, String time) {
        return industryAnalyzeMapper.getAllDeliveryCountryCount(secondCatTitleId,time);
    }

    /**
     * 获取价格区间
     * @return
     */
    @Override
    public List<String> getPriceSection() {
        return industryAnalyzeMapper.getPriceSection();
    }

    /**
     * 获取各个月份价格区间内商品数量
     * @param times
     * @param secondCatId
     * @param priceSection
     * @return
     */
    @Override
    public List<Integer> getGoodsCount(List<String> times, Integer secondCatId, String priceSection) {
        return industryAnalyzeMapper.getGoodsCount(times, secondCatId, priceSection);
    }

    /**
     * 获取各个月份价格区间内商品数量比例
     * @param times
     * @param secondCatId
     * @param priceSection
     * @return
     */
    @Override
    public List<Double> getGoodsCountScale(List<String> times, Integer secondCatId, String priceSection) {
        return industryAnalyzeMapper.getGoodsCountScale(times, secondCatId, priceSection);
    }

    /**
     * 获取订单区间
     *
     * @return
     */
    @Override
    public List<String> getOrderSection() {
        return industryAnalyzeMapper.getOrderSection();
    }

    /**
     * 获取各个月份订单区间内商品数量
     *
     * @param times
     * @param secondCatId
     * @param orderSection
     * @return
     */
    @Override
    public List<Integer> getOrderCount(List<String> times, Integer secondCatId, String orderSection) {
        return industryAnalyzeMapper.getOrderCount(times, secondCatId, orderSection);
    }

    /**
     * 获取各个月份订单区间内商品数量比例
     *
     * @param times
     * @param secondCatId
     * @param orderSection
     * @return
     */
    @Override
    public List<Double> getOrderCountScale(List<String> times, Integer secondCatId, String orderSection) {
        return industryAnalyzeMapper.getOrderCountScale(times, secondCatId, orderSection);
    }

    /**
     * 获取二级类目店铺top10
     * @param secondCatId
     * @param time
     * @return
     */
    @Override
    public List<SecondCatShopTopTen> getSecondCatShopTopTen(Integer secondCatId, String time) {
        return industryAnalyzeMapper.getSecondCatShopTopTen(secondCatId, time);
    }


    /**
     * 获取二级类目商品top10
     * @param secondCatId
     * @param time
     * @return
     */
    @Override
    public List<SecondCatGoodsTopTen> getSecondCatGoodsTopTen(Integer secondCatId, String time) {
        return industryAnalyzeMapper.getSecondCatGoodsTopTen(secondCatId, time);
    }


    /**
     * 获取销量top10国家的top3物流渠道
     * @param secondCatId
     * @param time
     * @return
     */
    @Override
    public List<SecondCatTopLogistics> getTopTenCountryLogistics(Integer secondCatId, String time) {
        return industryAnalyzeMapper.getTopTenCountryLogistics(secondCatId, time);
    }

    /**
     * 获取top1物流订单量前三的国家
     * @param secondCatId
     * @return
     */
    @Override
    public List<String> getTopOneLogisticsTopThree(Integer secondCatId,String beginTime,String endTime) {
        return industryAnalyzeMapper.getTopOneLogisticsTopThree(secondCatId,beginTime,endTime);
    }

    /**
     * 获取国家各个月份top1物流的订单数量
     * @param secondCatId
     * @param times
     * @param countryName
     * @return
     */
    @Override
    public List<Integer> getCountryTopOneLogisticsCount(Integer secondCatId, List<String> times, String countryName) {
        return industryAnalyzeMapper.getCountryTopOneLogisticsCount(secondCatId, times, countryName);
    }

    /**
     * 获取Aliexpress前三国家名称
     *
     * @return
     */
    @Override
    public List<String> getAliexpressTopCountry() {
        return industryAnalyzeMapper.getAliexpressTopCountry();
    }

    /**
     * 获取Aliexpress前三国家各个月份订单占比
     * @param times
     * @param countryName
     * @param countryNames
     * @return
     */
    @Override
    public List<Double> getAliexpressTopCountryScale(List<String> times, String countryName, List<String> countryNames) {
        return industryAnalyzeMapper.getAliexpressTopCountryScale(times, countryName, countryNames);
    }

    /**
     * 获取Aliexpress前三类目名称
     * @return
     */
    @Override
    public List<String> getAliexpressTopSecondCat() {
        return industryAnalyzeMapper.getAliexpressTopSecondCat();
    }

    /**
     * 获取Aliexpress前三二级类目各个月份订单占比
     * @param times
     * @param secondCatName
     * @param secondCatNames
     * @return
     */
    @Override
    public List<Double> getAliexpressTopSecondCatScale(List<String> times, String secondCatName, List<String> secondCatNames) {
        return industryAnalyzeMapper.getAliexpressTopSecondCatScale(times, secondCatName, secondCatNames);
    }
}
